package com.atguigu.gmall.product.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.service.TestRedisService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test/product")
public class TestRedisController {
    @Resource
    private TestRedisService testRedisService;
    @GetMapping
    public Result testRedis(){
        //使用redis 的setNx
        //testRedisService.setRedisBySetNx();
        //使用redission实现分布式锁
       testRedisService.setRedisByRedission();
       return Result.ok();
    }
}
